<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>银行卡</title>
    <link rel="stylesheet" type="text/css" href="../../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/aui-pull-refresh.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../../css/style.css"/>
    <style>
        html,body{
            /*background: #fff;*/
        }
        .inner_header{
            font-size: 1.6rem;
            color: #000000;
            font-weight: 600;
            height: 6.9rem;
            margin: 0;
            padding: 2.4rem 0 0 0;
            box-sizing: border-box;
            background: none!important;
            box-shadow: 0rem 0rem 0.8rem 0rem rgba(0, 0, 0, 0.08);
            background: #fff!important;
        }
        .content{
            width: 100%;
            float: left;
            margin: 6.9rem 0 0 0;
        }
        .content_box{
            width: 93%;
        	height: 11.8rem;
        	border-radius: 0.9rem;
            margin:1.5rem auto 0 auto;
            box-sizing: border-box;
            padding: 2.5rem 1.45rem 1.2rem 2.6rem;
        }
        .content_box_title{
            width:100%;
            height: 3rem;
            float: left;
            position: relative;
        }
        .content_box_title_icon{
            width: 3rem;
	        height: 3rem;
            border-radius: 100%;
            background: #fff;
            float: left;
            position: absolute;
        }
        .content_box_title_icon img{
            width: 3rem;
	        height: 3rem;
            border-radius: 100%;
        }
        .card_name{
            width: 100%;
            height: 1.5rem;
            font-size: 1.5rem;
            line-height: 1.5rem;
            color: #ffffff;
            float: left;
            box-sizing: border-box;
            padding:  0 0 0 4.35rem;
            margin: 0.05rem 0 0.25rem 0;
        }
        .card_type{
            width: 100%;
            height: 1.2rem;
        	font-size: 1.2rem;
        	line-height: 1.2rem;
        	color: #ffffff;
            float: left;
            box-sizing: border-box;
            padding:  0 0 0 4.35rem;
        }
        .card_num{
            width: 100%;
            height: 1.8rem;
            line-height: 1.8rem;
            font-size: 1.8rem;
            color: #ffffff;
            box-sizing: border-box;
            padding: 0 0 0 4.35rem;
            float: left;
            margin: 2.3rem 0 0 0;
        }
        .relieve{
            width: 100%;
            height: 1.2rem;
        	font-size: 1.2rem;
        	line-height: 1.2rem;
        	letter-spacing: 0.07rem;
        	color: #ffffff;
            margin: 0.7rem 0 0 0;
            text-align: right;
        }
    </style>
</head>
<body>
    <div id="app">
        <header class="aui-bar aui-bar-nav aui-bar-light inner_header">
            <a class="aui-pull-left aui-btn" onclick="goBack()">
              <img src="../../../image/back.png">
            </a>
            <div class="aui-title">银行卡</div>
            <a class="aui-pull-right share_nav_right" onclick="go_url('capital_add_bankCard','./add_bankCard.html','')">
                <img class="success" src="../../../image/capital/icon3.png">
            </a>
        </header>
        <div class="content">
            <div class="content_box" v-for="(item,key) in bank_list" :style="key/2==0?'background-image: linear-gradient(90deg,#028db1 0%,#01b7a3 100%),linear-gradient(#d62018,#d62018);background-blend-mode: normal,normal;':'background-image: linear-gradient(90deg,#ff8b72 0%,#fe5264 100%),linear-gradient(#d62018,#d62018);background-blend-mode: normal,normal;'" >
                <div class="content_box_title">
                    <div class="content_box_title_icon">
                        <img :src="item.bank_logo" alt="">
                    </div>
                    <div class="card_name">
                        {{item.realname}}
                    </div>
                    <div class="card_type">
                        {{item.bank_type}}
                    </div>
                </div>
                <div class="card_num">
                    ****　****　****　{{item.last_cardid}}
                </div>
                <div class="relieve" @click="remove_bank(item.bank_id)">
                    解绑
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript" src="../../../script/api.js"></script>
<script type="text/javascript" src="../../../script/axios.min.js"></script>
<script type="text/javascript" src="../../../script/axios-config.js"></script>
<script type="text/javascript" src="../../../script/zepto.js"></script>
<script type="text/javascript" src="../../../script/vue.min.js"></script>
<script type="text/javascript" src="../../../script/swiper.min.js"></script>
<script type="text/javascript" src="../../../script/utils.js"></script>
<script type="text/javascript" src="../../../script/common.js"></script>
<script type="text/javascript" src="../../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../../script/aui-pull-refresh.js"></script>

<script type="text/javascript">

  apiready = function(){
    //setRefresh()
    var user_info = $api.getStorage('user_info');
    var token = $api.getStorage('token');
    var vue = new Vue({
        el:"#app",
        data:{
            token:token,
            user_info:user_info,
            bank_list:[]
        },
        mounted:function(){
            var that = this
            var data={
                token:this.token
            }
            that.get_list(data)
            api.addEventListener({
                name: 'updata_bank'
            }, function(ret, err) {
                console.log(JSON.stringify(ret.value.info))
                if(ret.value.info=="updata_bank"){
                    that.get_list(data)
                }
            });
        },
        methods:{
            remove_bank:function(id){
                var that = this
                console.log(id)
                var data = {
                    bank_id:id,
                    token: $api.getStorage('token')
                }
                Axios.post(window.Url.unbind_bank,data).then(function(res) {
                    console.log(JSON.stringify(res))
                    if(res.status==1){
                        var data={
                            token:that.token
                        }
                        that.get_list(data)
                    }
                });
            },
            get_list(data){
                var that = this
                Axios.post(window.Url.bank_list,data).then(function(res) {
                    var bank_list= res.list
                    that.bank_list = bank_list
                    // console.log(JSON.stringify(bank_list))
                });
            }
        },
    })
  }

  //刷新
  function setRefresh(){
      var pullRefresh = new auiPullToRefresh({
          container: document.querySelector('.aui-refresh-content'),
          triggerDistance: 100
      }, function(ret) {

          if (ret.status == "success") {
              setTimeout(function() {
                  pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
              }, 1500)
          }
      })
  }
  function goBack(){
      api.closeWin({});
  }
  function go_url(name,url,get){
      api.openWin({
          name: name,
          url: url,
          pageParam:{
            data:get
          }
      });
  }

</script>
